/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package exatrez.stripes.util;

import com.google.inject.Inject;
import com.google.inject.Singleton;
import exatrez.dao.RefShipVisitHeaderDAO;
import exatrez.model.RefShipVisitHeader;
import exatrez.model.RefShipVisitSub;
import exatrez.stripes.BaseActionBean;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;

/**
 *
 * @author Mansur
 */
@Singleton
public class ShipVisit3ListUtil extends BaseActionBean {
    
    @Inject
    protected com.google.inject.Provider<Session> sessionProvider;
    @Inject
    RefShipVisitHeaderDAO headerDAO;
    
    public List<RefShipVisitHeader> getListHeader(){
        StringBuilder query = new StringBuilder("SELECT a FROM RefShipVisitHeader a WHERE a.activeFlag = 'A' ");
        query.append("order by a.orderFlag asc ");
        
        Query q = sessionProvider.get().createQuery(query.toString());
        
        return q.list();
    }
    
    public List<RefShipVisitSub> getListSub(){
        StringBuilder query = new StringBuilder("SELECT a FROM RefShipVisitSub a WHERE a.activeFlag = 'A' ");
        query.append("order by a.orderFlag asc ");
        
        Query q = sessionProvider.get().createQuery(query.toString());
        
        return q.list();
    }
    
}
